index_js_file="assets/index-DKzAqD1K.js"

# 定义源目录和目标目录
current_dir="."
release_dir="dist"

# 切换到release目录
cd "$release_dir"

# 替换 index_js_file 中的 "https://previewcloud.d8d.fun/api/" 为 "http://52.95.31.249:9000/api/"
sed -i 's|https://previewcloud.d8d.fun/api/|http://52.95.31.249:9000/api/|g' "$index_js_file"

# 替换 index_js_file 中的 "https://d8d-desgin-preview-user.oss-cn-beijing.aliyuncs.com/" 为 "http://52.95.31.249:19000/d8dweb/"
sed -i 's|https://d8d-desgin-preview-user.oss-cn-beijing.aliyuncs.com/|http://52.95.31.249:19000/d8dweb/|g' "$index_js_file"

git add .
git commit -m "构建并准备发布"

# 使用git config存储用户名和密码
git config --global credential.helper store

git push -u origin "master"